home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / GLUT-3.7 / LIB / GLSMAP / smap_drawmesh.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-12  |  1.1 KB  |  51 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1998.  */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. #include <GL/glsmap.h>
  9.  
  10. #include "glsmapint.h"
  11.  
  12. void
  13. __smapDrawSphereMapMeshSide(SphereMapMesh *mesh, int side)
  14. {
  15.     INITFACE(mesh);
  16.     int i, j;
  17.  
  18.     for (i=0; i<mesh->steps-1; i++) {
  19.         glBegin(GL_QUAD_STRIP);
  20.         for (j=0; j<mesh->steps; j++) {
  21.             glTexCoord2fv (FACEst(side,i,j));
  22.             glVertex2fv   (FACExy(side,i,j));
  23.             glTexCoord2fv (FACEst(side,i+1,j));
  24.             glVertex2fv   (FACExy(side,i+1,j));
  25.         }
  26.         glEnd();
  27.     }
  28. }
  29.  
  30. /* Back face specially rendered for its singularity! */
  31. void
  32. __smapDrawSphereMapMeshBack(SphereMapMesh *mesh)
  33. {
  34.     INITBACK(mesh);
  35.     int side, i, j;
  36.  
  37.     for (side=0; side<4; side++) {
  38.         for (j=0; j<mesh->rings-1+mesh->edgeExtend; j++) {
  39.             glBegin(GL_QUAD_STRIP);
  40.             for (i=0; i<mesh->steps; i++) {
  41.                 glTexCoord2fv (BACKst(side,j,i));
  42.                 glVertex2fv   (BACKxy(side,j,i));
  43.                 glTexCoord2fv (BACKst(side,j+1,i));
  44.                 glVertex2fv   (BACKxy(side,j+1,i));
  45.             }
  46.             glEnd();
  47.         }
  48.     }
  49. }
  50.  
  51.